import request from '@/utils/request'

// 创建供应商
export function createSupplier(data) {
  return request({
    url: '/ems/supplier/create',
    method: 'post',
    data: data
  })
}

// 更新供应商
export function updateSupplier(data) {
  return request({
    url: '/ems/supplier/update',
    method: 'put',
    data: data
  })
}

// 删除供应商
export function deleteSupplier(id) {
  return request({
    url: '/ems/supplier/delete?id=' + id,
    method: 'delete'
  })
}

// 获得供应商
export function getSupplier(id) {
  return request({
    url: '/ems/supplier/get?id=' + id,
    method: 'get'
  })
}

// 获得供应商分页
export function getSupplierPage(query) {
  return request({
    url: '/ems/supplier/page',
    method: 'get',
    params: query
  })
}

// 导出供应商 Excel
export function exportSupplierExcel(query) {
  return request({
    url: '/ems/supplier/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}


// 删除入库信息
export function deleteInfo(id) {
  return request({
    url: '/ems/supplier/deleteInfo?id=' + id,
    method: 'delete'
  })
}

// 更新入库信息
export function updateInfo(data) {
  return request({
    url: '/ems/supplier/updateInfo',
    method: 'put',
    data: data
  })
}

// 获取精简信息列表
export function listSimpleSuppliers() {
  return request({
    url: 'ems/supplier/list-all-simple',
    method: 'get'
  })
}
